for _ in range(int(input())):
n = int(input())
xys = []
for i in range(n):
for j, c in enumerate(input()):
if c == '*':
xys.append((i, j))
(x1, y1), (x2, y2) = xys
if x1 == x2:
x2 = (x1 + 1) % n
elif y1 == y2:
y2 = (y1 + 1) % n
t = [(x1, y1), (x2, y2), (x1, y2), (x2, y1)]
for i in range(n):
print(''.join('.*'[(i, j) in t] for j in range(n)))
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,i,j,i1,i2,j1,j2,temp;
char arr[400][400];
cin>>t;
while(t--){
temp=0;
cin>>n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin>>arr[i][j];
if (temp==0 && arr[i][j]=='*')
{
i1=i;
j1=j;
temp=1;
}
else if (temp==1 && arr[i][j]=='*')
{
i2=i;
j2=j;
}
}
}
if(i1==i2)
{
if(i1==n-1)
{
arr[i1-1][j1]='*';
arr[i1-1][j2]='*';
}
else if(i1<n)
{
arr[i1+1][j1]='*';
arr[i1+1][j2]='*';
}
}
else if(j1==j2)
{
if(j1==n-1)
{
arr[i1][j1-1]='*';
arr[i2][j1-1]='*';
}
else if(j1<n)
{
arr[i1][j1+1]='*';
arr[i2][j1+1]='*';
}
}
else
arr[i1][j2]='*';
arr[i2][j1]='*';
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cout<<arr[i][j];
}
cout<<"\n";
}
}
}
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |